package com.example.shiwuyouproject.ui.fragment.my.activity

import android.view.LayoutInflater
import androidx.lifecycle.Observer
import com.example.shiwuyouproject.R
import com.example.shiwuyouproject.base.BaseVmActivity
import com.example.shiwuyouproject.databinding.ActivityMycommentsBinding
import com.example.shiwuyouproject.ui.fragment.my.activity.adapter.MyCommentsAdapter
import com.example.shiwuyouproject.ui.fragment.my.activity.bean.MyApplicationBean
import com.example.shiwuyouproject.ui.fragment.my.activity.bean.MyCommentsBean
import com.example.shiwuyouproject.ui.fragment.my.activity.viewmodel.MyCommentsViewModel
import com.example.shiwuyouproject.ui.fragment.my.bean.GetCommentListsBean
import com.example.shiwuyouproject.ui.fragment.my.bean.WorkTimeBean
import com.example.shiwuyouproject.ui.fragment.my.bean.myDataBean

/**
 * 我的评价
 */
class MyCommentsActivity : BaseVmActivity<ActivityMycommentsBinding, MyCommentsViewModel>() {
    override fun viewModelClass(): Class<MyCommentsViewModel> = MyCommentsViewModel::class.java

    override fun getViewBinding(): ActivityMycommentsBinding {
        return ActivityMycommentsBinding.inflate(layoutInflater)
    }
    private var myAdapter: MyCommentsAdapter?=null
    override fun initView() {
        mBinding.myTitleBar.tvTitle.text="我的评价"
        myAdapter=MyCommentsAdapter()
        val mview = LayoutInflater.from(this).inflate(R.layout.view_nodata, null)
        myAdapter?.emptyView = mview
        mBinding.myRecyclerView.adapter=myAdapter
        mViewModel.getUserCenter()
    }

    override fun setListener() {
        mBinding.myTitleBar.tvBack.setOnClickListener { finish() }
    }

    override fun observe() {
        mViewModel.getUserCenterState.observe(this, Observer<GetCommentListsBean>{
            myAdapter?.setNewData(it.data)


        })

    }
}